package team.gzjmzy.system.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import team.gzjmzy.system.mapper.TStudentMapper;
import team.gzjmzy.system.domain.entity.TStudent;
import team.gzjmzy.system.service.ITStudentService;

/**
 * 学生管理Service业务层处理
 * 
 * @author gzjmzy
 * @date 2021-08-05
 */
@Service
public class TStudentServiceImpl extends ServiceImpl<TStudentMapper, TStudent> implements ITStudentService {

    @Override
    public List<TStudent> queryList(TStudent tStudent) {
        LambdaQueryWrapper<TStudent> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(tStudent.getName())){
            lqw.like(TStudent::getName ,tStudent.getName());
        }
        if (StringUtils.isNotBlank(tStudent.getStudentId())){
            lqw.eq(TStudent::getStudentId ,tStudent.getStudentId());
        }
        if (tStudent.getSex() != null){
            lqw.eq(TStudent::getSex ,tStudent.getSex());
        }
        if (tStudent.getDelTime() != null){
            lqw.eq(TStudent::getDelTime ,tStudent.getDelTime());
        }
        if (tStudent.getStatus() != null){
            lqw.eq(TStudent::getStatus ,tStudent.getStatus());
        }
        return this.list(lqw);
    }

    /**
        * 查询通过Id
        * @param id
        */
    @Override
    public TStudent queryById(String id) {
        return this.getById(id);
    }

    /**
     * 新增
     */
    @Override
    public boolean add(TStudent tStudent) {
        return this.save(tStudent);
    }

    /**
     * 修改
     */
    @Override
    public boolean edit(TStudent tStudent) {
        return this.updateById(tStudent);
    }

                                            
    /**
     * 删除
     */
    @Override
    public boolean delByIds(List<String> idList) {
        return this.removeByIds(idList);
    }

}
